import React from "react";

import {isNotNull} from '../../common';

import UICardTabs from '../../uicomponents/UICardTabs';
/** 
 *编辑产品信息
*/
export default class ProductDefineEditCardTabPanel extends React.Component {

    onTabChange = (tabName) => {
        const {onTabChange} = this.props;
        if(isNotNull(onTabChange)){
            onTabChange(tabName,this);
        }
    }

    render() {
    
        const {getTabItemComponent} = this.props;
    
                
        const tabPanelContentMap = {
                                
            '/ProductDefineBasicInfoPanel': {

                getComponent: (owner, props) => {
                
                    if(isNotNull(getTabItemComponent)){
                        const component = getTabItemComponent('/ProductDefineBasicInfoPanel',owner, props);
                        return isNotNull(component) ? component : <div>/ProductDefineBasicInfoPanel</div>
                    }
                    else{
                        return (<div>/ProductDefineBasicInfoPanel</div>);
                    }
                }
            },
                                            
            '/ProductVersionListInfoPanel': {

                getComponent: (owner, props) => {
                
                    if(isNotNull(getTabItemComponent)){
                        const component = getTabItemComponent('/ProductVersionListInfoPanel',owner, props);
                        return isNotNull(component) ? component : <div>/ProductVersionListInfoPanel</div>
                    }
                    else{
                        return (<div>/ProductVersionListInfoPanel</div>);
                    }
                }
            },
                                            
            '/ProductRoleDefineListInfoPanel': {

                getComponent: (owner, props) => {
                
                    if(isNotNull(getTabItemComponent)){
                        const component = getTabItemComponent('/ProductRoleDefineListInfoPanel',owner, props);
                        return isNotNull(component) ? component : <div>/ProductRoleDefineListInfoPanel</div>
                    }
                    else{
                        return (<div>/ProductRoleDefineListInfoPanel</div>);
                    }
                }
            },
                                            
            '/ProductTeamInfoPanel': {

                getComponent: (owner, props) => {
                
                    if(isNotNull(getTabItemComponent)){
                        const component = getTabItemComponent('/ProductTeamInfoPanel',owner, props);
                        return isNotNull(component) ? component : <div>/ProductTeamInfoPanel</div>
                    }
                    else{
                        return (<div>/ProductTeamInfoPanel</div>);
                    }
                }
            },
                            
        };

        const configProps = {
            tabConfigId: 'ProductUI:productDefineEditTabPanel',
            onTabChange: this.onTabChange,
            tabContentMap: tabPanelContentMap,
            history : this.props.history,
        };

        return (
            <UICardTabs {...configProps} {...this.props}>
            </UICardTabs>
        );
    }
}